package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;

/**
 * 用户基本信息
 * @author Jian
 */
@Entity
@Table
public class UserInfo implements Serializable {

	private static final long serialVersionUID = -6272468132792298545L;
	
	
	private Integer code;
	private String email;							// 邮箱
	private String pwd;								// 密码
	private String mobile;							// 电话
	private String realName;						// 真实姓名
	private Boolean deleted = false;				// 是否删除
	private String pageStyle;						// 页面样式名称
	private Boolean isManager;						// 是否管理员
	private String card;							// 身份证编号
	
	private Boolean sex;							// 性别
	private Date birthday;							// 生日
	private Date entryTime;							// 入职时间
	private Integer qq;								// QQ


	private Integer oc;								// 机构编号
	private Integer rc;								// 角色编号
	private Integer cu;								// 创建人

	private Date ct = new Date();					// 创建时间
	
	private Integer pc;								// 用户父机构编号
	
	private String pinyin;							// 姓名全拼
	private String py;								// 姓名拼音首字母
	private String name;							//用户名
	private String phone;							//电话
	private Integer basicWage;						//基本工资


	// formula
	private String rn;								// 角色名称
	private String on;								// 机构名称
	private Integer otc;							// 机构类型编号

	private List<UserAnnex> anList;					// 附件





	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	
	@Column(length = 50)
	public String getEmail() {
		return email;
	}
	
	@Column(length = 32)
	public String getPwd() {
		return pwd;
	}
	
	@Column(length = 50)
	public String getMobile() {
		return mobile;
	}
	
	@Column(length = 50)
	public String getRealName() {
		return realName;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	
	@Column
	public Integer getOc() {
		return oc;
	}

	@Column
	public Integer getRc() {
		return rc;
	}
	
	@Column(length = 20)
	public String getPageStyle() {
		return pageStyle;
	}
	
	@Column
	public Boolean getIsManager() {
		return isManager;
	}
	
	@Column(length = 20)
	public String getCard() {
		return card;
	}
	
	@Column
	public Boolean getSex() {
		return sex;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getBirthday() {
		return birthday;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getEntryTime() {
		return entryTime;
	}
	@Column
	public Integer getQq() {
		return qq;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	
	@Column(length = 60)
	public String getPinyin() {
		return pinyin;
	}
	
	@Column(length = 10)
	public String getPy() {
		return py;
	}
	
	@Column
	public String getName() {
		return name;
	}
	@Column
	public String getPhone() {
		return phone;
	}
	@Column
	public Integer getBasicWage() {
		return basicWage;
	}

	@Formula("(SELECT p.name FROM Role p WHERE p.code = rc)")
	public String getRn() {
		return rn;
	}

	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}

	@Formula("(SELECT o.otc FROM Organ o WHERE o.code = oc)")
	public Integer getOtc() {
		return otc;
	}
	
	@Formula("(SELECT o.pc FROM Organ o WHERE o.code = oc)")
	public Integer getPc() {
		return pc;
	}
	@Transient
	public List<UserAnnex> getAnList() {
		return anList;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	public void setAnList(List<UserAnnex> anList) {
		this.anList = anList;
	}

	public void setName(String name) {
		this.name = name;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public void setBasicWage(Integer basicWage) {
		this.basicWage = basicWage;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public void setRealName(String realName) {
		this.realName = realName;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setRc(Integer rc) {
		this.rc = rc;
	}
	public void setPageStyle(String pageStyle) {
		this.pageStyle = pageStyle;
	}
	public void setIsManager(Boolean isManager) {
		this.isManager = isManager;
	}
	public void setCard(String card) {
		this.card = card;
	}
	public void setSex(Boolean sex) {
		this.sex = sex;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public void setEntryTime(Date entryTime) {
		this.entryTime = entryTime;
	}
	public void setQq(Integer qq) {
		this.qq = qq;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}

	

	public void setRn(String rn) {
		this.rn= rn;
	}
	public void setOn(String on) {
		this.on = on;
	}
	public void setOtc(Integer otc) {
		this.otc = otc;
	}

	public void setPc(Integer pc) {
		this.pc = pc;
	}
	public void setPinyin(String pinyin) {
		this.pinyin = pinyin;
	}
	public void setPy(String py) {
		this.py = py;
	}
}
